import { defineStore } from "pinia";
import { createCommonActions } from "../commonActions";
import _axios from "~/common/axios";

export const useVillageStore = defineStore("village", {
  state: () => ({}),
  actions: {
    ...createCommonActions("village"),
    takeRegions() {
      return new Promise((resolve, reject) => {
        _axios
          .GET({
            url: `/village/take`,
            data: {},
          })
          .then((res) => {
            resolve(res);
          })
          .catch((e) => {
            reject(e);
          });
      });
    },
    _inputTip(payload: any) {
      return new Promise((resolve, reject) => {
        _axios
          .POST({
            url: "/village/inputtips",
            data: payload,
          })
          .then((res) => {
            resolve(res);
          })
          .catch((e) => {
            reject(e);
          });
      });
    },
  },
  getters: {},
});
